#include "undocommand.h"

#include <QGraphicsItem>

AddRoomCommand::AddRoomCommand(GwScene *scene)
{
    this->scene=scene;
    this->sharp=new GwRectangle();
    this->sharp->setConfig();
}

AddRoomCommand::~AddRoomCommand()
{
    delete this->sharp;
}


void AddRoomCommand::undo()
{
    this->scene->removeItem(this->sharp);
//    this->scene->removeItem(this->sharp);
}

void AddRoomCommand::redo()
{
    this->scene->addItem(this->sharp);
//    this->scene->addItem(this->sharp);
}


AddDetectorCommand::AddDetectorCommand(GwScene *scene)
{
    this->scene=scene;
    this->sharp=new GwDetector();
    this->sharp->setConfig();
}

AddDetectorCommand::~AddDetectorCommand()
{
    delete this->sharp;
}

void AddDetectorCommand::undo()
{
    this->scene->removeItem(this->sharp);
}

void AddDetectorCommand::redo()
{
    this->scene->addItem(this->sharp);
}

AddStringCommand::AddStringCommand(GwScene *scene)
{
    this->scene=scene;
    this->txt=new GwText();
    this->txt->setHtml("text");
    this->txt->setConfig();
}

AddStringCommand::~AddStringCommand()
{
    delete this->txt;
}

void AddStringCommand::undo()
{
    this->scene->removeItem(this->txt);
}

void AddStringCommand::redo()
{
    this->scene->addItem(this->txt);
}
